package com.cloud.custom.tasklist.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.cloud.custom.common.utils.BaseMapperHelper;
import com.cloud.custom.tasklist.entity.TaskList;

public interface TaskListMapper extends BaseMapperHelper<TaskList> {

	@Select("select t1.task_list_id, t1.task_list_name, t2.group_id, t2.group_name from task_list t1, task_list_group t2 where t1.group_id = t2.group_id order by t2.display_order, t1.display_order")
	@Results({ @Result(property = "taskListId", column = "task_list_id", javaType = Long.class),
			@Result(property = "taskListName", column = "task_list_name", javaType = String.class),
			@Result(property = "groupId", column = "group_id", javaType = Integer.class),
			@Result(property = "groupName", column = "group_name", javaType = String.class) })
	List<TaskList> listTaskListTree();
	
	
	@Select("select t1.task_list_id, t1.task_list_name, t2.group_id, t2.group_name from task_list t1, task_list_group t2 where t1.group_id = t2.group_id and t2.biz_id = #{bizId} order by t2.display_order, t1.display_order")
	@Results({ @Result(property = "taskListId", column = "task_list_id", javaType = Long.class),
			@Result(property = "taskListName", column = "task_list_name", javaType = String.class),
			@Result(property = "groupId", column = "group_id", javaType = Integer.class),
			@Result(property = "groupName", column = "group_name", javaType = String.class) })
	List<TaskList> listTaskListTreeByBizId(@Param("bizId") Integer bizId);

}